package system;

import android.view.MotionEvent;

public class Touch {
	private static boolean s_bIsHolded;
	private static boolean s_bIsTouched; 
	private static float s_fXDiff;
	private static float s_fYDiff;
	private static float s_fLastX;
	private static float s_fLastY;
	private static float s_fX;
	private static float s_fY;
	
	 public static boolean onTouchEvent(final MotionEvent event) {
	        if (event.getAction() == MotionEvent.ACTION_DOWN) {
	        	s_fX = event.getX();
	            s_fY = event.getY();
	        	s_bIsTouched = true;

	        }
	        else{
	        	s_bIsTouched = false;
	        }
	        if (event.getAction() == MotionEvent.ACTION_MOVE) {
	        	s_fXDiff = (s_fX - event.getX());
	            s_fYDiff = (s_fY - event.getY());
	            
	        	s_fX = event.getX();
	            s_fY = event.getY();
	        }
	        else{
	        	s_fXDiff = 0;
	        	s_fYDiff = 0;
	        }
	        return true;

	    }
	 
	 public static float GetX(){
		 return s_fX;
	 }
	 
	 public static float GetY(){
		 return s_fY;
	 }
	 
	 public static float GetDiffX(){
		 return s_fXDiff;
	 }
	 
	 public static float GetDiffY(){
		 return s_fYDiff;
	 }
	 
	 public static boolean IsTouched(){
		 return s_bIsTouched;
	 }
	 
	 public static boolean IsMoved(){
		return (s_fXDiff != 0) && (s_fYDiff != 0);
	 }
	 

}
